//
//  CardDallocTableViewCell.m
//  LoveAttention
//
//  Created by 鞠超 on 15/12/31.
//  Copyright © 2015年 JC. All rights reserved.
//

#import "CardDallocTableViewCell.h"

@interface CardDallocTableViewCell ()

@property (nonatomic, strong) UIImageView * view_bg;

@property (nonatomic, strong) UIImageView * line;

@end

@implementation CardDallocTableViewCell

- (instancetype )initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self)
    {
        [self p_setupView];
    }
    return self;
}

- (void)p_setupView
{
    self.view_bg = [[UIImageView alloc] init];
    self.view_bg.image = [UIImage imageNamed:@"头像两个下面的两栏背景图"];
    self.view_bg.layer.masksToBounds = YES;
    self.view_bg.layer.cornerRadius = 10;
    [self.contentView addSubview:self.view_bg];
    
    self.view_color = [[UIView alloc] init];
    self.view_color.backgroundColor = [UIColor orangeColor];
    [self.view_bg addSubview:self.view_color];
    
    self.line = [[UIImageView alloc] init];
    self.line.image = [UIImage imageNamed:@"huabian_@2x"];
    [self.view_bg addSubview:self.line];
    
    self.image = [[UIImageView alloc] init];
    self.image.layer.cornerRadius = 30;
    self.image.backgroundColor = [UIColor blackColor];
    [self.view_bg addSubview:self.image];
    
    self.detail = [[UILabel alloc] init];
    self.detail.text = @"满200减20现金抵券";
    self.detail.font = [UIFont systemFontOfSize:22];
    self.detail.textColor = [UIColor whiteColor];
    [self.view_bg addSubview:self.detail];
    
    self.name = [[UILabel alloc] init];
    self.name.text = @"几点开始就就是看到几十块";
    self.name.textColor = [UIColor grayColor];
    self.name.font = [UIFont systemFontOfSize:13];
    [self.view_bg addSubview:self.name];
    
    self.status = [[UILabel alloc] init];
    self.status.text = @"已使用";
    self.status.textColor = [UIColor grayColor];
    self.status.textAlignment = NSTextAlignmentRight;
    self.status.font = [UIFont systemFontOfSize:13];
    [self.view_bg addSubview:self.status];
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.view_bg.frame = CGRectMake(15, 15, self.contentView.frame.size.width - 30, self.contentView.frame.size.height - 25);
    
    self.view_color.frame = CGRectMake(0, 0, self.view_bg.frame.size.width, 95);
    
    self.line.frame = CGRectMake(0, CGRectGetMaxY(self.view_color.frame) - 3, self.view_color.frame.size.width, 3);
    
    self.image.frame = CGRectMake(10, 15, 60, 60);
    
    self.detail.frame = CGRectMake(CGRectGetMaxX(self.image.frame) + 5, CGRectGetMidY(self.image.frame) - 20, self.view_bg.frame.size.width - 15 - CGRectGetMaxX(self.image.frame), 40);
    
    self.name.frame = CGRectMake(10, CGRectGetMaxY(self.view_color.frame) + 5, 180, 25);
    
    self.status.frame = CGRectMake(self.view_color.frame.size.width - 10 - 70, CGRectGetMaxY(self.view_color.frame) + 5, 70, 25);
}









@end
